package com.holly.unit.deform.util;

import javax.servlet.http.HttpServletRequest;

/**
 * 类描述: 获取服务地址工具类
 *
 * @author fxr
 * @version 1.0.0
 * @date 2022/4/12 13:58
 */
public class BaseUrlUtil {

    /**
     * 获取服务器地址
     *
     * @param request
     * @return
     */
    public static String getBaseUrl(HttpServletRequest request) {
        String scheme = request.getScheme();
        String serverName = request.getServerName();
        int serverPort = request.getServerPort();
        String contextPath = request.getContextPath();
        return scheme + "://" + serverName + ":" + serverPort + contextPath;
    }

}
